package com.modules.test;

import java.io.Serializable;

import org.activiti.engine.delegate.DelegateExecution;

public class MulitiInstanceCompleteTask implements Serializable {  
    private static final long serialVersionUID = 1L;  
    public boolean completeTask(DelegateExecution execution) {  
        System.out.println("总的会签任务数量：" + execution.getVariable("nrOfInstances") + "当前获取的会签任务数量：" + execution.getVariable("nrOfActiveInstances") + " - " + "已经完成的会签任务数量：" + execution.getVariable("nrOfCompletedInstances"));
        //完成会签的次数  
        Integer completeCounter=(Integer)execution.getVariable("nrOfCompletedInstances");  
        //总循环次数  
        Integer instanceOfNumbers=(Integer)execution.getVariable("nrOfInstances");  
        System.out.println("I am invoked.");  
        System.out.println(completeCounter/instanceOfNumbers);
        if(completeCounter*1.0/instanceOfNumbers >0.5) {
        	return true;
        }else {
        	return false;  
        }
        
    }  
}